package com.weimei.conversionTreasure.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelProviders;

import android.os.Bundle;

import com.weimei.conversionTreasure.R;
import com.weimei.conversionTreasure.app.AppViewModelFactory;
import com.weimei.conversionTreasure.databinding.ActivityJxsDetailBinding;
import com.weimei.conversionTreasure.viewModel.JxsDetailVM;
import com.weimei.conversionTreasure.viewModel.KhDetailVM;

import me.goldze.mvvmhabit.base.BaseActivity;
import me.tatarka.bindingcollectionadapter2.BR;

public class JxsDetailActivity extends BaseActivity<ActivityJxsDetailBinding, JxsDetailVM> {


    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_jxs_detail;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }


    String id;
    @Override
    public void initParam() {
        super.initParam();
        id = getIntent().getStringExtra("id");
    }

    @Override
    public void initData() {
        super.initData();
        viewModel.setContext(this);
        viewModel.getData(id);
    }


    @Override
    public JxsDetailVM initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getApplication());
        return ViewModelProviders.of(this, (ViewModelProvider.Factory) factory).get(JxsDetailVM.class);
    }
}